var express = require('express');
var router = express.Router();

var Grade = require("../model/grade");

/* GET home page. */
router.get('/', function (req, res, next) {
    res.end("/grade")
});

router.get('/all', async function (req, res, next) {
    try {
        var list = await Grade.find();
        res.json({
            status: 200,
            message: "OK",
            list: list
        })
    } catch (err) {
        res.json({
            status: 500,
            message: err.message,
        })
    }
});

module.exports = router;
